package com.example.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.entity.Business;
import com.example.entity.KHMS;
import com.example.mapper.BusinessMapper;
import com.example.service.IBusinessService;
import com.example.util.QueryBean;
import com.example.util.page;
import com.example.util.page4;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tyhxzy
 * @since 2023-11-03
 */
@Service
public class BusinessServiceImpl implements IBusinessService {

    @Autowired
    private BusinessMapper businessMapper;
    //分页查询
    @Override
    public Page<Map> findByParams(page page) {
        Page p1 = new Page(page.getPageNo(), page.getPageSize());
        return businessMapper.findByParams(p1, page);
    }

    @Override
    public Business findBusinessByName(String name) {

        LambdaQueryWrapper<Business> l1=new LambdaQueryWrapper<>();
        l1.eq(Business::getCompanyname,name);
        Business business = businessMapper.selectOne(l1);
        return business;

    }

    @Override
    public List<Business> findByBName(Business business) {
        return businessMapper.findByBName(business);
    }



    //查询全部
    @Override
    public Business findByid(Integer id) {
        return businessMapper.findByid(id);
    }

    @Override
    public Page<Map> findpage(page4 page4) {
        Page p1 = new Page(page4.getPageNo(), page4.getPageSize());
        return businessMapper.findpage(p1,page4);
    }

    @Override
    public int add(KHMS khms) {
        return businessMapper.add(khms);
    }


}
